package com.imeth.cms.dao;

import com.imeth.base.MyBatisDao;
import com.imeth.cms.Template;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * 模板
 * Created by huangcheng.dong on 2015/12/19.
 */
@MyBatisDao
public interface TemplateDao {

    @Options(useGeneratedKeys=true, keyProperty="id")
    @Insert("insert into t_template(name,description) values(#{name},#{description})")
    int save(Template template);

    @Select("select * from t_template")
    List<Template> query();

    @Select("select * from t_template where id=#{id}")
    Template getById(Integer id);

    @Delete("delete from t_template where id=#{id}")
    int deleteById(Integer id);

    @Update("update t_template set name=#{name},desc=#{desc} where id=#{id}")
    int update(Template template);
}
